﻿namespace MicroCloud.Options
{
    /// <summary>
    /// Cors跨域策略选项
    /// </summary>
    public class CorsOption
    {
        #region 属性
        /// <summary>
        /// 获取或设置 策略名称
        /// </summary>
        public string PolicyName { get; set; }

        /// <summary>
        /// 获取或设置 允许任意请求头
        /// </summary>
        public bool AllowAnyHeader { get; set; }

        /// <summary>
        /// 获取或设置 允许的请求头
        /// 当 AllowAnyHeader = false 时生效
        /// </summary>
        public string[] WithHeaders { get; set; }

        /// <summary>
        /// 获取或设置 允许任意方法
        /// </summary>
        public bool AllowAnyMethod { get; set; }

        /// <summary>
        /// 获取或设置 允许的方法
        /// 当 AllowAnyMethod = false 时生效
        /// </summary>
        public string[] WithMethods { get; set; }

        /// <summary>
        /// 获取或设置 允许跨域凭据
        /// 优先级高于 DisallowCredentials 设置
        /// </summary>
        public bool AllowCredentials { get; set; }

        /// <summary>
        /// 获取或设置 禁止跨域凭据
        /// </summary>
        public bool DisallowCredentials { get; set; }

        /// <summary>
        /// 获取或设置 允许任意来源
        /// </summary>
        public bool AllowAnyOrigin { get; set; }

        /// <summary>
        /// 获取或设置 允许的来源
        /// 当 AllowAnyOrigin = false 时生效
        /// </summary>
        public string[] WithOrigins { get; set; }

        /// <summary>
        /// 获取或设置 是否启用跨源资源共享服务
        /// </summary>
        public bool Enabled { get; set; }

        #endregion

    }


}
